package xyz.zhno.adapter;

/**
 * 适配器
 * @author zh_o
 * @date 2020-11-15
 */
public class Adapter implements Voltage5V {

    /**
     * 引用目标类
     */
    private final Voltage220V voltage;

    public Adapter(Voltage220V voltage) {
        this.voltage = voltage;
    }

    /**
     * 输出电压 5V
     * @return 电压
     */
    @Override
    public Integer output5V() {
        // 获取原电压
        Integer source = voltage.output220V();
        // 转换
        return source / 44;
    }

}
